﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="CadastroDoIdoso.aspx.cs" Inherits="LarDosIdosos.CadastroDoIdoso" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div style="float:left; width:100%;">
    <asp:UpdatePanel ID="updatePanelFileUpload" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
    <ContentTemplate>
    	<asp:HiddenField ID="hiddenFieldCodigoIdoso" runat="server" />
		<div style="float:left;width:70%;">
	        <asp:LinkButton ID="linkButtonVoltar" runat="Server" OnClick="linkButtonVoltar_OnClick" Style="float:right;">Voltar</asp:LinkButton>
	    </div>
	    <div style="float:left;width:100%;text-align:center;">
	        <asp:Label ID="labelFeedback" runat="server"/>
	    </div>
		<div style="float:left;width:100%;">
		    <table width="50%" cellspacing="20px" align="center" >
				
		        <tr>
		            <td>
		                Nome do idoso:
		            </td>
		            <td>
		                <asp:TextBox ID="textNomeDoIdoso" runat="server" Width="100%"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                CPF:
		            </td>
		            <td>
		                <asp:TextBox ID="textCpfDoIdoso" runat="server" CssClass="cpf"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td colspan="2">
		                <asp:UpdatePanel ID="updatePanelAdicionarResponsavel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
		                    <ContentTemplate>
		                    	<table width="100%">
		                            <tr>
		                                <td colspan="2">
		                                    Responsáveis pelo idoso:
		                                </td>
		                            </tr>
		                            <tr>
		                                <td colspan="2">
		                                    <asp:GridView
		                                        ID="gridViewResponsaveis"
		                                        runat="server"
		                                        Width="60%"
		                                        AutoGenerateColumns="False"
						                        BackColor="#E9E9E9"
						                        GridLines="None"
		                                        CellPadding="2"
		                                        OnRowDataBound="gridViewResponsaveis_OnRowDataBound"
		                                        >
		                                        <AlternatingRowStyle BackColor="#f7f7f7"/>
						                        <HeaderStyle BackColor="#EEEEEE" ForeColor="Black" />
							                    <RowStyle Height="50px" BackColor="#FFFFFF"/>
		                                        <EmptyDataRowStyle BackColor="#F7F7F7" Height="50px" VerticalAlign="Middle" HorizontalAlign="Center" />
		                                        <EmptyDataTemplate >
		                                            Nenhum Resultado Encontrado
		                                        </EmptyDataTemplate>
		                                        <Columns>
		                                            <asp:TemplateField HeaderStyle-Width="1%" ShowHeader="false">
							                            <ItemTemplate>
		                                                    <asp:HiddenField ID="hiddenFieldId" runat="server" Value='<%# Eval("Codigo_Responsavel") %>' />
						                                </ItemTemplate>
						                            </asp:TemplateField>
		                                            <asp:TemplateField HeaderText="Nome">
						                                <ItemTemplate> 
						                                    <asp:Label ID="labelNomeDoResponsave" runat="server" Text='<%# Eval("Nome_Responsavel") %>' ></asp:Label>
						                                </ItemTemplate>
						                                <headerstyle Width="30%"/>
						                            </asp:TemplateField>
		                                            <asp:TemplateField HeaderText="CPF">
						                                <ItemTemplate> 
						                                    <asp:Label ID="labelCpfDoResponsavel" runat="server" Text='<%# Eval("CPF_Responsavel") %>' ></asp:Label>
						                                </ItemTemplate>
						                                <headerstyle Width="20%"/>
						                            </asp:TemplateField>
		                                            <asp:TemplateField HeaderText="Grau de Parentesco">
						                                <ItemTemplate> 
						                                    <asp:TextBox ID="textBoxGrauDeParentesco" runat="server" Text='<%# Eval("Grau_de_Parentesco") %>' ></asp:TextBox>
						                                </ItemTemplate>
						                                <headerstyle Width="20%"/>
						                            </asp:TemplateField>
		                                        </Columns>
		                                    </asp:GridView>
		                                    <asp:GridView
		                                        ID="gridViewAddResponsaveis"
		                                        runat="server"
		                                        Width="60%"
		                                        AutoGenerateColumns="False"
						                        BackColor="#E9E9E9"
						                        GridLines="None"
		                                        CellPadding="2"
		                                        OnRowDataBound="gridViewAddResponsaveis_OnRowDataBound"
		                                        >
		                                        <AlternatingRowStyle BackColor="#f7f7f7"/>
						                        <HeaderStyle BackColor="#EEEEEE" ForeColor="Black" />
							                    <RowStyle Height="50px" BackColor="#FFFFFF"/>
		                                        <EmptyDataRowStyle BackColor="#F7F7F7" Height="300px" VerticalAlign="Middle" HorizontalAlign="Center" />
		                                        <EmptyDataTemplate >
		                                            Nenhum Resultado Encontrado
		                                        </EmptyDataTemplate>
		                                        <Columns>
		                                            <asp:TemplateField HeaderStyle-Width="1%" ShowHeader="false">
							                            <ItemTemplate>
		                                                    <asp:HiddenField ID="hiddenFieldId" runat="server" Value='<%# Eval("Codigo_Responsavel") %>' />
						                                </ItemTemplate>
						                            </asp:TemplateField>
		                                            <asp:TemplateField HeaderStyle-Width="1%" ShowHeader="false">
							                            <ItemTemplate>
		                                                    <asp:CheckBox ID="checkBoxSelecionaResponsavel" runat="server" />
						                                </ItemTemplate>
						                            </asp:TemplateField>
		                                            <asp:TemplateField HeaderText="Nome">
						                                <ItemTemplate> 
						                                    <asp:Label ID="labelNomeDoResponsave" runat="server" Text='<%# Eval("Nome_Responsavel") %>' ></asp:Label>
						                                </ItemTemplate>
						                                <headerstyle Width="30%"/>
						                            </asp:TemplateField>
		                                            <asp:TemplateField HeaderText="CPF">
						                                <ItemTemplate> 
						                                    <asp:Label ID="labelCpfDoResponsavel" runat="server" Text='<%# Eval("CPF_Responsavel") %>' ></asp:Label>
						                                </ItemTemplate>
						                                <headerstyle Width="20%"/>
						                            </asp:TemplateField>
		                                        </Columns>
		                                    </asp:GridView>
		                                </td>
		                            </tr>
		                            <tr>
		                                <td>
		                                    <asp:Button ID="buttonAddResponsavel" Text="Adicionar Responsável" runat="server" OnClick="buttonAddResponsavel_OnClick" />
		                                    <asp:Button ID="buttonFinalizarAddResponsavel" Text="Finalizar" runat="server" OnClick="buttonFinalizarAddResponsavel_OnClick" />
		                                </td>
		                            </tr>
		                        </table>
                                
		                    </ContentTemplate>
                            <Triggers>
                                <asp:PostBackTrigger ControlID="buttonAddResponsavel" />
                                <asp:PostBackTrigger ControlID="buttonFinalizarAddResponsavel" />
                            </Triggers>
		                </asp:UpdatePanel>
		            </td>
		        </tr>
				<tr>
		            <td>
		                Relatório de Encaminhamento:
		            </td>
		            <td>
		                <asp:Label ID="statusFileUploadRelatorio" runat="server" Text=""></asp:Label>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Selecionar novo Relatório:
		            </td>
		            <td>
						<asp:HiddenField id="hiddenFieldLocalRelatorioIdoso" runat="server"></asp:HiddenField>
		                <asp:FileUpload ID="fileUploadRelatorioDeEncaminhamento" runat="server"  />
		            </td>
		        </tr>
				<tr>
		            <td>
		                Foto:
		            </td>
		            <td>
		                <asp:Image id="imageFotoIdoso" runat="server"></asp:Image>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Selecionar Foto:
		            </td>
		            <td>
						<asp:HiddenField id="hiddenFieldLocalFotoIdoso" runat="server"></asp:HiddenField>
		                <asp:FileUpload ID="fileUploadFotoIdoso" runat="server"  />
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Estado Civil:
		            </td>
		            <td>
		                <asp:DropDownList ID="dropDownListEstadoCivil" runat="server">
		                    <asp:ListItem Text="Solteiro" Value="1"></asp:ListItem>
		                    <asp:ListItem Text="Casado" Value="2"></asp:ListItem>
		                </asp:DropDownList>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                RG:
		            </td>
		            <td>
		                <asp:TextBox ID="textRgDoIdoso" runat="server"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Grau de instrução:
		            </td>
		            <td>
		                <asp:TextBox ID="textBoxGrauDeIntrucao" runat="server"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Naturalidade:
		            </td>
		            <td>
		                <asp:TextBox ID="textBoxNaturalidade" runat="server"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Nacionalidade:
		            </td>
		            <td>
		                <asp:TextBox ID="textBoxNacionalidade" runat="server"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Nome do Pai:
		            </td>
		            <td>
		                <asp:TextBox ID="textBoxNomeDoPai" runat="server" Width="100%"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Nome da Mãe:
		            </td>
		            <td>
		                <asp:TextBox ID="textBoxNomeDaMae" runat="server" Width="100%"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Sexo:
		            </td>
		            <td>
		            <asp:RadioButtonList ID="radioButtonListSexoDoIdoso" runat="server">
		                <asp:ListItem Text="Masculino" Value="1" />
		                <asp:ListItem Text="Feminino" Value="2"/>
		            </asp:RadioButtonList>
		                                    
		            </td>
		        </tr>
		        <tr>
		            <td>
		                Data de Nascimento:
		            </td>
		            <td>
		                <asp:TextBox ID="textDataDeNascimento" runat="server"></asp:TextBox>
		            </td>
		        </tr>
		        <tr>
		            <td colspan="2">
		                Funcionário que recebeu:
		            </td>
		        </tr>
		        <tr>
		            <td colspan="2">
		                <asp:GridView
		                    ID="gridViewFuncionario"
		                    runat="server"
		                    Width="80%"
		                    AutoGenerateColumns="False"
						    BackColor="#E9E9E9"
						    GridLines="None"
		                    CellPadding="2"
		                    >
		                    <AlternatingRowStyle BackColor="#f7f7f7"/>
						    <HeaderStyle BackColor="#EEEEEE" ForeColor="Black" />
							<RowStyle Height="50px" BackColor="#FFFFFF"/>
		                    <EmptyDataRowStyle BackColor="#F7F7F7" Height="300px" VerticalAlign="Middle" HorizontalAlign="Center" />
		                    <EmptyDataTemplate >
		                        Nenhum Resultado Encontrado
		                    </EmptyDataTemplate>
		                    <Columns>
		                        <asp:TemplateField HeaderStyle-Width="1%" ShowHeader="false">
							        <ItemTemplate>
		                                <asp:HiddenField ID="hiddenFieldId" runat="server" Value='<%# Eval("Codigo_Funcionario") %>' />
						            </ItemTemplate>
						        </asp:TemplateField>
		                        <asp:TemplateField HeaderText="Nome">
						            <ItemTemplate> 
						                <asp:Label ID="labelNomeDoFuncionario" runat="server" Text='<%# Eval("Nome_Funcionario") %>' ></asp:Label>
						            </ItemTemplate>
						            <headerstyle Width="30%"/>
						        </asp:TemplateField>
		                        <asp:TemplateField HeaderText="Cargo">
						            <ItemTemplate> 
						                <asp:Label ID="labelCargoDoFuncionario" runat="server" Text='<%# Eval("Cargo_Funcionario.NomeCargo") %>' ></asp:Label>
						            </ItemTemplate>
						            <headerstyle Width="20%"/>
						        </asp:TemplateField>
		                        <asp:TemplateField HeaderText="Email">
						            <ItemTemplate> 
						                <asp:Label ID="labelEmailDoFuncionario" runat="server" Text='<%# Eval("Email_Funcionario") %>' ></asp:Label>
						            </ItemTemplate>
						            <headerstyle Width="40%"/>
						        </asp:TemplateField>
		                    </Columns>
		                </asp:GridView>
		            </td>
		        </tr>
		        <tr>
		            <td>
		                                   
		            </td>
		            <td>
		                <asp:Button ID="buttonSalvar" runat="server" Text="Salvar" OnClick="buttonSalvar_Onclick" Visible="true"/>
		            </td>
		        </tr>
		
		    </table>
		</div>
    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="buttonSalvar" />
    </Triggers>
</asp:UpdatePanel>
</div>
    <script type="text/javascript">
        carregarCalendario = function () {
            $("#<%= textDataDeNascimento.ClientID %>").datepicker({ dateFormat: "dd/mm/yy" });
        };

        carregarMascara = function () {
            $("#<%= textCpfDoIdoso.ClientID %>").mask("999.999.999-99");
        };
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(carregarCalendario);
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(carregarMascara);
	</script>
</asp:Content>
